home *** CD-ROM | disk | FTP | other *** search
- /*
- This script must be placed in the DOpus5:System/CopyTo directory
- (create it if it doesn't already exist).
- You must set the comment of the script file to the entry
- you want displayed in the CopyTo menu. You must also set the S
- protection bit.
-
- This will cause an entry to be created in the Copy >> menu in
- file and directory popup menus. Selecting this entry will
- cause the script to be launched.
- */
-
- parse arg filename portname source
- options results
-
- If ~Show("P",'trash-handler') then do
- dopus request '"WARNING!!!:"'|| '0a'x ||'" Global Trash is not running!!" OK'
- Exit
- End
-
- if open(1,'Env:trash.prefs','R') then do
- do i=1 to 6
- prefs.i = readln(1)
- end
-
- if prefs.4 ~="" then trashpath=prefs.4
- Call close(1)
- end
-
- filename=strip(filename,B,'"')
- if pos(":",filename)~=0 then do
- parse var filename ':'filename1
- if lastpos("/",filename1)=length(filename1) then do
- type = 1
- filename1=delstr(filename1,lastpos("/",filename1),length(filename1))
- if pos("/",filename1)~=0 then do
- do until pos("/",filename1)=0
- parse var filename1 '/'filename1
- end
- end
- end
- else do
- if pos("/",filename1)~=0 then do
- do until pos("/",filename1)=0
- parse var filename1 '/'filename1
- end
- end
- type = -1
- end
- printpath=delstr(filename,pos(filename1,filename),length(filename))
-
- if type < 0 then do
- /* Only Files */
- address command 'Move 'filename' to 'trashpath''
- address command 'Echo >'trashpath||filename1||.path' 'printpath''
- Address Command 'SetDate 'trashpath||filename1''
- end
-
- if type > 0 then do
- /* Dirs */
- address command 'Move 'filename' to 'trashpath||filename1''
- address command 'Echo >'trashpath||filename1||.path' 'printpath''
- Address Command 'SetDate 'trashpath||filename1''
- end
-